#define ARGTYPE_FILE 0x00000005
#define ARGTYPE_OUTFILE 0x00000006
#define ARGTYPE_REQUIRED 0x40000000
+#define ARGTYPE_HIDDEN 0x20000000
#define ARGTYPE_TYPEMASK 0x00000fff
#define ARGTYPE_FLAGMASK 0xfffff000
printf(" %-20.20s %-50.50s\n",
vec->name, vec->desc);
for (ap = vec->vec->args; ap && ap->argstring; ap++) {
- printf(" %-18.18s %-.50s %s\n",
+ if ( !(ap->argtype & ARGTYPE_HIDDEN ))
+ printf(" %-18.18s %-.50s %s\n",
ap->argstring, ap->helpstring,
(ap->argtype&ARGTYPE_REQUIRED)?"(required)":"");
}
static char *opt_replace = NULL;
static char *opt_swap = NULL;
static char *opt_depth = NULL;
+static char *nowarn = NULL;
+static int warnings_enabled = 1;
static int swapdepth = 0;
static
{"swap", &opt_swap, "Swap waypoint list with <depth> item on stack",
NULL, ARGTYPE_BOOL},
{"depth", &opt_depth, "Item to use when swapping", NULL, ARGTYPE_INT},
+ {"nowarn", &nowarn, "Suppress cleanup warning", NULL,
+ ARGTYPE_INT | ARGTYPE_HIDDEN},
{0, 0, 0, 0, 0}
};
int invalid = 0;
+ if ( nowarn ) {
+ warnings_enabled = 0;
+ }
+
if ( opt_depth ) {
swapdepth = atoi( opt_depth );
}
stackfilt_exit( void ) {
struct stack_elt *tmp_elt = NULL;
- if ( stack ) {
+ if ( warnings_enabled && stack ) {
warning( MYNAME " Warning: leftover stack entries; "
"check command line for mistakes\n" );
}
#
# stack filter tests
# These don't actually test for proper behavior, for now, but they do
-# exercise all of the currently-extant filter code except for the "clean
-# up leftover stacks" code that would output a warning. Of course, that
-# code is the most likely to generate memory leaks, so maybe we need a
-# 'nowarn' option to the stack filter so we can test it...
+# exercise all of the currently-extant filter code.
#
-${PNAME} -i geo -f geocaching.loc -x stack,push,copy -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -x stack,pop -o arc -F ${TMPDIR}/stackfilt.txt
+${PNAME} -i geo -f geocaching.loc -x stack,push,copy,nowarn -x stack,push,copy -x stack,push -x stack,pop,replace -x stack,pop,append -x stack,push,copy -x stack,pop,discard -x stack,swap,depth=1 -o arc -F ${TMPDIR}/stackfilt.txt
exit 0
for (i=0;i<vc;i++) {
printf(VEC_FMT, svp[i]->name, svp[i]->desc);
for (ap = svp[i]->vec->args; ap && ap->argstring; ap++) {
- printf(" %-18.18s %-.50s %s\n",
- ap->argstring, ap->helpstring,
- (ap->argtype & ARGTYPE_REQUIRED)?"(required)":"");
+ if ( !(ap->argtype & ARGTYPE_HIDDEN))
+ printf(" %-18.18s %-.50s %s\n",
+ ap->argstring, ap->helpstring,
+ (ap->argtype & ARGTYPE_REQUIRED)?"(required)":"");
}
}